package models

import (
	"goods_srv/basic/config"
	"time"
)

type Address struct {
	Id        uint64    `gorm:"column:id;type:bigint UNSIGNED;primaryKey;not null;" json:"id"`
	UserId    int32     `gorm:"column:user_id;type:int;not null;" json:"user_id"`
	Address   string    `gorm:"column:address;type:varchar(50);not null;" json:"address"`
	CreatedAt time.Time `gorm:"column:created_at;type:datetime;default:CURRENT_TIMESTAMP;" json:"created_at"`
	UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;default:CURRENT_TIMESTAMP;" json:"updated_at"`
	DeleteAt  time.Time `gorm:"column:delete_at;type:datetime;default:NULL;" json:"delete_at"`
}

func (a *Address) TableName() string {
	return "address"
}
func (a *Address) AddressList() (list []*Address, err error) {
	err = config.DB.Find(&list).Error
	return list, err
}
